//
//  DCProgressView.m
//  DCDownloadOpration
//
//  Created by collegepre on 16/4/1.
//  Copyright © 2016年 Wade. All rights reserved.
//

#import "DCProgressView.h"
#import "UIView+DCDownload.h"

@interface DCProgressView()

@end

@implementation DCProgressView


- (void)setProgress:(CGFloat)progress
{
    _progress = progress;
    [self setNeedsDisplay];
}



- (void)drawRect:(CGRect)rect {
    
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetRGBStrokeColor(context,255,0,0,1.0);//画笔线的颜色

    CGContextSetLineWidth(context, 3.0);
    //  x,y为圆点坐标，radius半径，startAngle为开始的弧度，endAngle为 结束的弧度，clockwise 0为顺时针，1为逆时针。
    CGContextAddArc(context, self.width / 2, self.height / 2, self.width / 2 - 2, 0, self.progress * 2 * M_PI, 0); //添加一个圆
    CGContextStrokePath(context);
}


@end
